<?php

$prefix = config('probackend::config.sites.prefix');

Route::group(array('prefix' => $prefix, 'before' => 'probackend.before'), function() use($prefix){

    Route::get('/', function() use($prefix) {
        return Illuminate\Support\Facades\Redirect::route($prefix . '.dashboard');
    });

    Route::get('/dashboard', array(
        'as' => $prefix . '.dashboard',
        'uses' => 'Johnm\Probackend\Controllers\ProBackendController@dashboard',
    ));

    Route::get('/profile', array(
        'as' => $prefix . '.profile',
        'uses' => 'Johnm\Probackend\Controllers\ProBackendController@profile',
    ));

    Route::get('/login', array(
        'as' => $prefix . '.login',
        'uses' => 'Johnm\Probackend\Controllers\ProBackendController@login',
    ));

    Route::get('/deny/{msg?}', array(
        'as' => $prefix . '.deny',
        'uses' => 'Johnm\Probackend\Controllers\ProBackendController@deny',
    ));

    Route::post('/authen', array(
        'as' => $prefix . '.authen ',
        'uses' => 'Johnm\Probackend\Controllers\ProBackendController@authen',
    ));

    Route::get('/logout', array(
        'as' => $prefix . '.logout',
        'uses' => 'Johnm\Probackend\Controllers\ProBackendController@logout',
    ));

    Route::get('/lang/{lang_uri}', array(
        'as' => $prefix . '.language',
        'uses' => 'Johnm\Probackend\Controllers\ProBackendController@language',
    ));

    Route::get('/userinfo', array(
        'as' => $prefix . '.userinfo',
        'uses' => 'Johnm\Probackend\Controllers\ProBackendController@userinfo',
    ));



    /*
      |--------------------------------------------------------------------------
      | Crub controller
      |--------------------------------------------------------------------------
     */
    crub_route("administrator_group", "Johnm\Probackend\Controllers\AdministratorGroupController");
    crub_route("administrator_user", "Johnm\Probackend\Controllers\AdministratorUserController");
});
